<%@page import="com.tubeonfire.model.admin.ChannelModel"%>
<%@page import="com.tubeonfire.entity.Playlist"%>
<%@page import="com.tubeonfire.model.admin.PlaylistModel"%>
<%@page import="com.tubeonfire.entity.SiteConfig"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	SiteConfig siteConfig = (SiteConfig)request.getAttribute("siteConfig");
	PlaylistModel plModel = new PlaylistModel();	
	plModel.prepareAll(true);
	ChannelModel chModel = new ChannelModel();
	chModel.prepareList();
%>
<jsp:include page="/admin/elements/header.jsp">
	<jsp:param value="System Form" name="title"/>
</jsp:include>
<script type="text/javascript" src="/admin/js/mine/admin.js"></script>
<script type="text/javascript" src="/admin/js/mine/form_system.js"></script>
	<body class="loggedin">
		<jsp:include page="/admin/elements/top.jsp"/>
	    <!-- START OF MAIN CONTENT -->
	    <div class="mainwrapper">
	     	<div class="mainwrapperinner">         	        
				<jsp:include page="/admin/elements/left.jsp">
					<jsp:param value="config" name="current_page"/>
				</jsp:include>					              	                   
	        	<div class="maincontent noright">
	        		<%
	        			if(siteConfig!=null){
	        		%>
	        		<div class="maincontentinner">	            	
		                <ul class="maintabmenu">
		                	<li class="current"><a href="/admin/config?obj=system">System</a></li>
		                	<li><a href="/admin/config?obj=cache">Cache</a></li>
		                	<li><a href="/admin/config?obj=logo">Logo</a></li>
		                	<li><a href="/admin/config?obj=seo">SEO</a></li>
                			<li><a href="/admin/config?obj=social">Social</a></li>
                			<li><a href="/admin/config?obj=slideshow">Slideshow</a></li>
		                </ul><!--maintabmenu-->	                
	                	<div class="content">	
	                	<jsp:include page="/admin/elements/message.jsp"/>
	                	<div id="messageDiv" class="notification hidden">						   
						    <p></p>
						</div>	   	                    
	                    	<div class="contenttitle">
	                    		<h2 class="image"><span>Fill Information</span></h2>
	                    	</div>
	                    	<br />
		                    <form class="stdform" action="/admin/config" method="post" id="configForm">
		                    <input type="hidden" name="obj" value="system">
		                    	<p>
		                        	<label>Admin Email</label>
		                            <span class="field">
		                            	<input type="text" name="adminEmail" class="smallinput" value="<%=siteConfig.getAdminEmail()%>"/>		                            	
		                            </span>		  
		                            <small class="desc">Must be Appengine Administrator Email. Any message from user will be sent to this email.</small>                          		                           
		                        </p>   
		                    	<p>
		                        	<label>Home page display object : </label>
		                            <span class="field">
		                            	<select name="displayObject" id="displayObject">
		                            		<option value="1" <%=(siteConfig.getHomePageDisplayObject()==1)?"selected='selected'":""%>>Playlist</option>
		                            		<option value="2" <%=(siteConfig.getHomePageDisplayObject()==2)?"selected='selected'":""%>>Channel</option>
		                            	</select>		                            	
		                            </span>		                            		                           
		                        </p>                     	
		                        <p id="playlistNumber">
		                        	<label>Block quanlity : </label>
		                            <span class="field">
		                            	<select name="homePagePlaylistQuantity">
		                            		<%		                            			
		                            			for(int i = 1; i<= plModel.getListResult().size();i++){
		                            		%>
		                            			<option value="<%=i%>" <%=(siteConfig.getHomePageBlockQuantity()==i)?"selected='selected'":""%>><%=i%></option>
		                            		<%
		                            			}
		                            		%>
		                            	</select>		                            	
		                            </span>		                            		                           
		                        </p> 
		                        <p id="channelNumber">
		                        	<label>Block quanlity : </label>
		                            <span class="field">
		                            	<select name="homePageChannelQuantity">
		                            		<%		                            			
		                            			for(int i = 1; i<= chModel.getListResult().size();i++){
		                            		%>
		                            			<option value="<%=i%>" <%=(siteConfig.getHomePageBlockQuantity()==i)?"selected='selected'":""%>><%=i%></option>
		                            		<%
		                            			}
		                            		%>
		                            	</select>		                            	
		                            </span>		                            		                           
		                        </p>    
		                        <p>
		                        	<label>Number of video per block : </label>
		                            <span class="field">
		                            	<select name="homePageTubeQuantity">
		                            		<%
                                        		for(int i = 1; i<=30;i++){ 
	                                       	%>                                     	
	                                        	<option value="<%=i %>" <%=(siteConfig.getHomePageTubePerBlockQuantity()==i)?"selected='selected'":""%>><%=i%></option>                                    
	                                       	<%
	                                        	}
	                                       	%>
		                            	</select>		                            			                            
		                            </span>		                            		                           
		                        </p>    		                          		                                                                                        		                                                                                                                                                       
                        		<br clear="all" />                         		                
		                        <p class="stdformbutton">
		                        	<button class="submit radius2" id="btnSubmit">Submit</button>
		                            <input type="reset" class="reset radius2" value="Reset" />		                            		                           
		                        </p>                                                
                    		</form>             
	                    <br /><br />	                    
	                </div><!--content-->	                
	            </div><!--maincontentinner-->
	            <%
	        			}
	            %>
				<jsp:include page="/admin/elements/bottom.jsp"></jsp:include>                    	           	
	        </div><!--maincontent-->	                        
	     	</div><!--mainwrapperinner-->
	    </div><!--mainwrapper-->
		<!-- END OF MAIN CONTENT -->    
	</body>
</html>
